// pages/login/index.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    account: '',
    password: '',
    redirectURL:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad({redirectURL}) {
    console.log(redirectURL)
    this.setData({
      redirectURL
    })
  }, 
  async submant() {
    console.log(wx)
    const res = await wx.http.post('/driver/login/account',{
      account:this.data.account,
      password:this.data.password
    })
    console.log(res)
    if(res.code !== 200) return wx.utils.toast('登录失败')
    app.setToken('token', res.data)
    wx.switchTab({
      url: this.data.redirectURL,
    })
  }

})